function createDBconnect() {
  const mysqlConfig = require("./DBconfig.js");
  const mysql = require("mysql");
  const connect = mysql.createConnection(mysqlConfig); //创建数据库连接
  //连接数据库
  connect.connect(function (err) {
    if (err) {
      console.log(`mysql连接失败: ${err}!`);
    } else {
      console.log("mysql连接成功!");
    }
  });

  return connect;
}

module.exports = createDBconnect;
